#!/bin/ksh
if [[ $# -ne 3 ]]; then
	echo "USAGE::Incorrect number of argumnets"
	exit 0
fi
	i=0
while read line
do
	if [[ $i -eq 1 ]]; then
	echo ""
		SF1=`echo $line|cut -d"[" -f2|cut -d"," -f1`
		PF1=`echo $line|cut -d"," -f2`
		OF1=`echo $line|cut -d"," -f3`
		CF1=`echo $line|cut -d"," -f4|cut -d"]" -f1` #echo $CF1
#		echo $SF1 $PF1 $OF1 $CF1 
	elif [[ $i -eq 2 ]]; then
		iJNP=`echo $line|cut -d"," -f1`
		iJONO=`echo $line|cut -d"," -f2`
		iRSF=`echo $line|cut -d"," -f3`
		iRPF=`echo $line|cut -d"," -f4`
		iROF=`echo $line|cut -d"," -f5`
		iRCF=`echo $line|cut -d"," -f6`
		iLONP=`echo $line|cut -d"," -f7`
		iORS=`echo $line|cut -d"," -f8`
		iORO=`echo $line|cut -d"," -f9`
#		echo $iJNP $iJONO $iRSF $iRPF $iROF $iRCF $iLONP $iORS $iORO
	elif [[ $i -eq 4 ]]; then
		oJNP=`echo $line|cut -d"," -f1`
		oJONO=`echo $line|cut -d"," -f2`
		oRSF=`echo $line|cut -d"," -f3`
		oRPF=`echo $line|cut -d"," -f4`
		oROF=`echo $line|cut -d"," -f5`
		oRCF=`echo $line|cut -d"," -f6`
		oLONP=`echo $line|cut -d"," -f7`
		oORS=`echo $line|cut -d"," -f8`
		oORO=`echo $line|cut -d"," -f9`
#		echo $oJNP $oJONO $oRSF $oRPF $oROF $oRCF $oLONP $oORS $oORO
	elif [[ $i -eq 6 ]]; then
		SO=`echo $line|cut -d"," -f1`
		NP=`echo $line|cut -d"," -f2`
		NumPages=`echo $line|cut -d"," -f3`
#		echo $SO $NP $NumPages
	else
		echo ""
	fi
	i=$((i+1))
done < QUERYFILE
exec java -jar phase3.jar $1 $SF1 $PF1 $OF1 $CF1 $iJNP $iJONO $iRSF $iRPF $iROF $iRCF $iLONP $iORS $iORO $oJNP $oJONO $oRSF $oRPF $oROF $oRCF $oLONP $oORS $oORO $SO $NP $NumPages $3 

